package com.linkwedo.saas.project;

import java.util.List;

import com.linkwedo.saas.domain.Time;

public class TimeService {
	private TimeDao TimeDao;

	public TimeDao getTimeDao() {
		return TimeDao;
	}

	public void setTimeDao(TimeDao TimeDao) {
		this.TimeDao = TimeDao;
	}

	public Time getTime(Time Time) {
		List<Time> uList = getTimeDao().findByExample(Time);
		return uList.get(0);
	}
	
	public void save(Time transientInstance) {		
		try {
			getTimeDao().save(transientInstance);		
		} catch (RuntimeException re) {			
			throw re;
		}
	}
	
	public List findAll() {		
		try {
			return getTimeDao().findAll();
		} catch (RuntimeException re) {
			throw re;
		}
	}
	
	
	public Time findByTimeID(Integer timeId) {		
		try {
			return  getTimeDao().findById(timeId);
		} catch (RuntimeException re) {
			throw re;
		}
	}
	
	public List findByTaskID(Integer taskId) {		
		try {
			return getTimeDao().findByTaskId(taskId);
		} catch (RuntimeException re) {
			throw re;
		}
	}
	public void deleteById(Integer pid) {		
		try {
			Time transientInstance = getTimeDao().findById(pid);
			transientInstance.setId(pid);
			getTimeDao().delete(transientInstance);		
		} catch (RuntimeException re) {			
			throw re;
		}
	}
	
	
}
